<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>${'$'}{SYSTEM_NAME}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="${'$'}{pageContext.request.contextPath}/static/layuiadmin/layui/css/layui.css?v=${'$'}{FILE_VERSION}" media="all">
	<link rel="stylesheet" href="${'$'}{pageContext.request.contextPath}/static/layuiadmin/style/admin.css?v=${'$'}{FILE_VERSION}" media="all">
  	<link rel="stylesheet" href="${'$'}{pageContext.request.contextPath}/static/js/zTree_v3/css/metroStyle/metroStyle.css?v=${'$'}{FILE_VERSION}" type="text/css">
</head>
<body>
<div style="border: 1px solid #ccc;" >
	<input id="queryTop" value="${'$'}{queryTop }" type="hidden">
	<input id="isFirst" value="${'$'}{isFirst }" type="hidden">
 	<ul id="treeRegion" class="ztree"></ul>
 </div>

<script src="${'$'}{pageContext.request.contextPath}/static/js/common-2.0.0.js?v=${'$'}{FILE_VERSION}"></script>
<script src="${'$'}{pageContext.request.contextPath}/static/layuiadmin/layui/layui.js?v=${'$'}{FILE_VERSION}"></script>
<script src="${'$'}{pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js?v=${'$'}{FILE_VERSION}"></script>

<script src="${'$'}{pageContext.request.contextPath}/static/js/zTree_v3/js/jquery.ztree.core.js?v=${'$'}{FILE_VERSION}"></script>
<script src="${'$'}{pageContext.request.contextPath}/static/js/zTree_v3/js/jquery.ztree.excheck.js?v=${'$'}{FILE_VERSION}"></script>
<script src="${'$'}{pageContext.request.contextPath}/static/js/zTree_v3/js/jquery.ztree.exedit.js?v=${'$'}{FILE_VERSION}"></script>
<script src="${'$'}{pageContext.request.contextPath}/static/js/common/zTree.drop.js?v=${'$'}{FILE_VERSION}"></script>
<script src="${'$'}{pageContext.request.contextPath}/static/js/common/coreTree-2.0.0.js?v=${'$'}{FILE_VERSION}"></script>
<script>

var setting = {
	data: {
		simpleData: {
			enable: true
		}
	},
	edit: {
		enable: false
	},
	async: {
		enable: true,
		url: getUrl
	},
	callback : {
		onClick: treeOnClick
	}
};

function getUrl(treeId, treeNode) {
	var queryTop = $("#queryTop").val();
	return  getContextPath() + '/${generatorTable.moudleName}/${generatorTable.shiro}/list/getByParentId?parentId=' + treeNode.id + "&queryTop=" + queryTop;
}

function treeOnClick(event, treeId, treeNode) {
	parentName = treeNode.name;
	parent.set${generatorTable.upperClassName}(treeNode.id, treeNode.name);
    closed();
}

$(document).ready(function(){
	treeReload("/${generatorTable.moudleName}/${generatorTable.shiro}/list/getByParentId");
});

function closed(){
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
	parent.layer.close(index);//关闭弹出的子页面窗口
}

</script>
</body>
</html>